package com.mallcloud.mall.app.api.entity.vo;

import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@ApiModel(value = "XglPartingPaymentInfoVO", description = "停车费查询")
@Data
public class XglPartingPaymentInfoVO implements Serializable {
	private static final long serialVersionUID = 1L;

	@ApiModelProperty("订单id")
	private String id;
	@ApiModelProperty("车场id")
	private String parkId;
	@ApiModelProperty("入场时间 时间戳")
	private String inTime;
	@ApiModelProperty("入场时间 yyyy-MM-dd HH:mm:ss")
	private String entryTime;
	@ApiModelProperty("停车时长 x天x小时x分钟")
	private String elapsedTimeStr;

	public void setInTime(String inTime) {
		this.inTime = inTime;
		this.entryTime = DateUtil.formatDate(new Date(Long.parseLong(inTime.concat("000"))));

		long currentTimeMillis = System.currentTimeMillis();
		long left = currentTimeMillis - Long.parseLong(inTime.concat("000"));//毫秒
		left = left / 60000;

		StringBuffer sb = new StringBuffer();
		if (left >= 1440) {
			sb.append(left / 1440);
			sb.append("天");
			left = left % 1440;
		}
		if (left >= 60) {
			sb.append(left / 60);
			sb.append("小时");
			left = left % 60;
		}
		sb.append(left);
		sb.append("分钟");
		this.elapsedTimeStr = sb.toString();
	}

	@ApiModelProperty("入场图片")
	private String inPic;
	@ApiModelProperty("车牌号")
	private String carNumber;
	@ApiModelProperty("总价(单位元)")
	private String total;
	@ApiModelProperty("还需付费(单位元)")
	private String price;
	@ApiModelProperty("已付金额")
	private String prepay;
	@ApiModelProperty("优惠减免金额")
	private String discount;

}
